﻿<Window x:Class="SoftTeach.View.Datenbank.FerienWorkspaceView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:resources="clr-namespace:SoftTeach.Resources" xmlns:SoftTeach="clr-namespace:SoftTeach"
        xmlns:Globalization="clr-namespace:System.Globalization;assembly=mscorlib"
        xmlns:controls="clr-namespace:SoftTeach.Resources.Controls" mc:Ignorable="d" 
        Title="Datenbank - Ferien"
        Icon="/SoftTeach;component/Images/Database.ico"
             d:DesignHeight="400" d:DesignWidth="800" WindowStyle="SingleBorderWindow">
    <Window.Resources>
    </Window.Resources>
    <Grid Background="{StaticResource MainBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="48"/>
            <RowDefinition Height="48"/>
            <RowDefinition/>
            <RowDefinition Height="32"/>
        </Grid.RowDefinitions>
        <controls:SmallDialogHeader  Icon="/SoftTeach;component/Images/Ferien32.png" 
                              Grid.Row="0" 
                              Title="Ergänzen oder entfernen Sie hier Ferien."/>
        <Border Grid.Row="1" Name="DescriptionArea">
            <StackPanel Orientation="Horizontal" Margin="5">
                <Button Width="150" Height="32" Name="AddButton" Command="{Binding Path=AddFerienCommand}">
                    <StackPanel Orientation="Horizontal">
                        <Grid>
                            <Image Source="/SoftTeach;component/Images/Ferien32.png"/>
                            <Image Source="/SoftTeach;component/Images/AddOverlay32.png"/>
                        </Grid>
                        <Label Content="Ferien hinzufügen"/>
                    </StackPanel>
                </Button>
                <Label></Label>
                <Button Width="150" Height="32" Name="RemoveButton" Command="{Binding Path=DeleteFerienCommand}">
                    <StackPanel Orientation="Horizontal">
                        <Grid>
                            <Image Source="/SoftTeach;component/Images/Ferien32.png"/>
                            <Image Source="/SoftTeach;component/Images/RemoveOverlay32.png"/>
                        </Grid>
                        <Label Content="Ferien entfernen"/>
                    </StackPanel>
                </Button>
            </StackPanel>
        </Border>
        <GroupBox Grid.Row="2" Header="Tabelle der Ferien" Padding="3" Margin="5">
      <DataGrid SelectedItem="{Binding Path=CurrentFerien, Mode=TwoWay}" ItemsSource="{Binding Source={x:Static SoftTeach:App.MainViewModel}, Path=Ferien}" AutoGenerateColumns="False">
                <DataGrid.Columns>
                    <DataGridComboBoxColumn 
                        Header="Schuljahr" 
                        ItemsSource="{Binding Source={x:Static SoftTeach:App.MainViewModel}, Path=Jahrtypen}"
                        SelectedItemBinding="{Binding Path=FerienJahrtyp}" 
                        DisplayMemberPath="JahrtypBezeichnung"
                        />
                    <DataGridTextColumn Header="Bezeichnung" Binding="{Binding Path=FerienBezeichnung}" />
                    <DataGridTemplateColumn Header="Erster Ferientag">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                <TextBlock Text="{Binding FerienErsterFerientag, StringFormat={}{0:dd. MMMM yyyy},ConverterCulture={x:Static Globalization:CultureInfo.CurrentCulture}}"/>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                        <DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <DatePicker SelectedDate="{Binding FerienErsterFerientag}"  />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellEditingTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn 
                        Header="Letzter Ferientag" 
                        Width="*" >
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                <TextBlock Text="{Binding FerienLetzterFerientag, StringFormat={}{0:dd. MMMM yyyy},ConverterCulture={x:Static Globalization:CultureInfo.CurrentCulture}}"/>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                        <DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <DatePicker SelectedDate="{Binding FerienLetzterFerientag}"  />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellEditingTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
            </DataGrid>
        </GroupBox>
        <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Name="OK" Width="80" Margin="3" IsDefault="True" Click="OkClick">OK</Button>
            <!--<Button Name="Abbrechen"  Width="80" Margin="3" IsCancel="True">Abbrechen</Button>-->
        </StackPanel>
    </Grid>
</Window>
